import { configureStore } from '@reduxjs/toolkit'
import { useDispatch, useSelector } from "react-redux";

//引入切片reducer
import imageReducer from './image'

//创建store对象
const store = configureStore({
    //引入所有的reducer模块对象
    reducer: {
        image:imageReducer
    }
})
//仓库的状态
export type RootState = ReturnType<typeof store.getState>
export type AppDispatch = typeof store.dispatch
//重写useSelector、useDispatch
export const useAppDispatch = useDispatch.withTypes<AppDispatch>()
export const useAppSelector = useSelector.withTypes<RootState>()

//抛出store对象
export default store